package com.example.graphql_demo.fetcher;

import com.example.graphql_demo.DTO.QueryDTO;
import com.example.graphql_demo.VO.QueryVO;
import org.springframework.graphql.data.method.annotation.Argument;
import org.springframework.graphql.data.method.annotation.QueryMapping;
import org.springframework.stereotype.Controller;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description: 参数 DTO, 返回值DTO
 * @Version: V1.0
 */
@Controller
public class DataFetcher {

		@QueryMapping
		public List<QueryVO> findByQuery(@Argument("queryDTO") QueryDTO queryDTO) {
				ArrayList<QueryVO> queryVOS = new ArrayList<>();
						QueryVO queryVO = new QueryVO();
						queryVO.setId(1);
						queryVO.setName(queryDTO.getName());
						queryVO.setAddress(queryDTO.getAddress());
						queryVO.setAge(queryDTO.getAge());
				queryVOS.add(queryVO);
				return queryVOS;
		}

}
